﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace eCommerce.CMS.CustomAdmin
{
    public partial class Register : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList roleDropDownList = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList");
            
            roleDropDownList.DataSource = Roles.GetAllRoles();
            roleDropDownList.DataBind();
        }
        protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
            DropDownList roleDropDownList = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList");
            Roles.AddUserToRole(CreateUserWizard1.UserName, roleDropDownList.SelectedValue);
        }
    }
}
